package com.esri.core.map;

import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class LayerRelationship {
    private int a;
    private String b;
    private int c;
    private String d;
    private Cardinality e;
    private Role f;
    private boolean g;

    /* loaded from: classes.dex */
    public enum Cardinality {
        ONE_TO_ONE("esriRelCardinalityOneToOne"),
        ONE_TO_MANY("esriRelCardinalityOneToMany"),
        MANY_TO_MANY("esriRelCardinalityManyToMany");
        
        String a;

        Cardinality(String str) {
            this.a = str;
        }

        public String getValue() {
            return this.a;
        }

        @Override // java.lang.Enum
        public String toString() {
            return super.toString() + "(" + this.a + ")";
        }

        public static Cardinality get(String str) {
            Cardinality[] values;
            for (Cardinality cardinality : values()) {
                if (cardinality.a.equals(str)) {
                    return cardinality;
                }
            }
            return null;
        }
    }

    /* loaded from: classes.dex */
    public enum Role {
        ORIGIN("esriRelRoleOrigin"),
        DESTINATION("esriRelRoleDestination");
        
        String a;

        Role(String str) {
            this.a = str;
        }

        public String getValue() {
            return this.a;
        }

        @Override // java.lang.Enum
        public String toString() {
            return super.toString() + "(" + this.a + ")";
        }

        public static Role get(String str) {
            Role[] values;
            for (Role role : values()) {
                if (role.a.equals(str)) {
                    return role;
                }
            }
            return null;
        }
    }

    public int getId() {
        return this.a;
    }

    public String getName() {
        return this.b;
    }

    public int getRelatedTableId() {
        return this.c;
    }

    public String getKeyField() {
        return this.d;
    }

    public Cardinality getCardinality() {
        return this.e;
    }

    public Role getRole() {
        return this.f;
    }

    public boolean isComposite() {
        return this.g;
    }

    public static LayerRelationship fromJson(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        LayerRelationship layerRelationship = new LayerRelationship();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("id".equals(currentName)) {
                layerRelationship.a = jsonParser.getIntValue();
            } else if ("name".equals(currentName)) {
                layerRelationship.b = jsonParser.getText();
            } else if ("relatedTableId".equals(currentName)) {
                layerRelationship.c = jsonParser.getIntValue();
            } else if ("cardinality".equals(currentName)) {
                layerRelationship.e = Cardinality.get(jsonParser.getText());
            } else if ("role".equals(currentName)) {
                layerRelationship.f = Role.get(jsonParser.getText());
            } else if ("keyField".equals(currentName)) {
                layerRelationship.d = jsonParser.getText();
            } else if ("composite".equals(currentName)) {
                layerRelationship.g = jsonParser.getBooleanValue();
            } else {
                jsonParser.skipChildren();
            }
        }
        return layerRelationship;
    }

    public String toString() {
        return "[Id: " + this.a + ", Name: " + this.b + ", RelatedTableId: " + this.c + ", Cardinality: " + this.e + ", Role: " + this.f + ", composite: " + this.g + "]";
    }
}
